import os
import sys

sys.path.append(os.getcwd())

from network_form.utils_network import load_all_graphs, read_data
from network_form.config import data_path
from network_form.config import graphs_path
from network_form.utils_downstream import history_response

from utils import *
from Model import *


if __name__ == "__main__":
    event_list, topic_dict, member_list, group_list = read_data(data_path, False)
    all_graphs = load_all_graphs(graphs_path)

    event1 = event_list[10]
    member1 = member_list[0]

    country_predict = CountryModel()
    print(country_predict(event1, member1))

    lon_lat_predict = LonLatModel(LonLatDiffMeasure(lon_threshold=10, lat_threshold=10))
    print(lon_lat_predict(event1, member1))

    history_predict = HistoryModel(all_graphs, group_list, TopicSimilarity())
    print(history_predict(event_list[1], member_list[1]))
    
    # 要划分event_list，一部分查找集，一部分测试集
    closest_member_predict = ClosestMemberModel(all_graphs, event_list, member_list, group_list)
    mem_id = str(list(event1['member and response'].keys())[0])
    mem = dict()
    for m in member_list:
        if str(m['id'])==mem_id:
            mem = m
    print(closest_member_predict(event1, mem))

    # 要划分event_list，一部分查找集，一部分测试集
    yes_tendency_predict = YesTendencyModel(event_list, member_list, 5)
    print(yes_tendency_predict(event1, member1))
